import 'package:flutter/material.dart';
import 'package:x_custom_widget/custom_widget.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Native Packages'),
        ),
        body: SingleChildScrollView(
          child: Container(
            color: Colors.blue,
            padding: const EdgeInsets.all(10),
            child: Column(
              children: [
                const CustomText(
                  '自定义CustomText',
                  color: Colors.yellow,
                  bgColor: Colors.green,
                  radius: 100,
                ),
                const CustomText(
                  '自定义CustomText EdgeInsets.all(12)  margin: EdgeInsets.all(12),',
                  color: Color.fromARGB(255, 95, 255, 59),
                  bgColor: Color.fromARGB(255, 94, 76, 175),
                  padding: EdgeInsets.all(12),
                  margin: EdgeInsets.all(12),
                  radius: 20,
                ),
                Row(
                  children: const [
                    CustomText('《左边》'),
                    Expanded(
                      child: CustomText(
                        '左边CustomText这里是一长串很长内容的字符串在Row中适配多少内容展示',
                        overflow: TextOverflow.ellipsis,
                        maxLines: 1,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                    CustomText('《右边》'),
                  ],
                ),
                const CustomText(
                  '给定CustomText宽高',
                  bgColor: Colors.pink,
                  width: 200,
                  height: 100,
                  radius: 20,
                ),
                const CustomText(
                  '给定CustomText宽高,横纵剧中',
                  bgColor: Colors.purpleAccent,
                  width: 200,
                  height: 100,
                  radius: 20,
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.center,
                ),
                const CustomImage(
                    radius: 30,
                    fit: BoxFit.fill,
                    url:
                        'http://gips2.baidu.com/it/u=195724436,3554684702&fm=3028&app=3028&f=JPEG&fmt=auto?w=1280&h=960'),
                const CustomImage(
                    width: 300,
                    url:
                        'https://img2.baidu.com/it/u=3025436647,2731283935&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=11500'),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
